Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for PHPStan 2 #348

Merged
merged 23 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8b6538b
Allow usage with PHPStan ^2.0
alexander-schranz Nov 11, 2024
eac5abf
Require new versons
alexander-schranz Nov 11, 2024
e60ec15
Fix composer style
alexander-schranz Nov 11, 2024
dc23ccf
Fix selectSingle
alexander-schranz Nov 11, 2024
ebed389
Do first-pass refactoring
Jean85 Nov 13, 2024
37d8420
promote types
sasezaki Nov 15, 2024
b0e86b1
make static-code-analysis-baseline
sasezaki Nov 15, 2024
03bd022
Remove not longer required stubs
sasezaki Nov 15, 2024
315866a
Use PHP's reflection to get stub object, instead of prophesize() call
sasezaki Nov 16, 2024
572847d
Update tests basesline
sasezaki Nov 16, 2024
5fb9c1e
Update composer.lock
sasezaki Nov 16, 2024
af0682a
composer update
sasezaki Nov 16, 2024
1470fd3
require --dev phpspec/prophecy-phpunit
sasezaki Nov 16, 2024
d78f12b
drop support phpunit<9.1 , according to prophecy-phpunit requirements
sasezaki Nov 16, 2024
cbb6902
Update php-cs-fixer config , and apply
sasezaki Nov 16, 2024
8ce5187
Update test's nullable property
sasezaki Nov 16, 2024
3c35259
adding use statement https://github.com/Jan0707/phpstan-prophecy/pull…
sasezaki Nov 18, 2024
4696fad
Remove TypeNodeResolverExtension - https://github.com/Jan0707/phpstan…
sasezaki Nov 18, 2024
a4b90c0
Remove ProphesizeDynamicReturnTypeExtension & Update phpspec/prophecy…
sasezaki Nov 20, 2024
cb3a9c7
Update baselines & composer normalize
sasezaki Nov 20, 2024
7061ef1
revert comment out (reason of comment outed is that not asserted Gene…
sasezaki Nov 20, 2024
c9ab262
apply php-cs-fixer & Update baseline
sasezaki Nov 20, 2024
87dcaf8
revert it back to instanceof. - https://github.com/Jan0707/phpstan-pr…
sasezaki Nov 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test/ export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php_cs export-ignore
.php-cs-fixer.php export-ignore
.yamllint.yaml export-ignore
composer.lock export-ignore
Makefile export-ignore
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
php-version:
- "7.1"
- "7.4"

dependencies:
- "locked"
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
restore-keys: "php-${{ matrix.php-version }}-php-cs-fixer-"

- name: "Run friendsofphp/php-cs-fixer"
run: "vendor/bin/php-cs-fixer fix --ansi --config=.php_cs --diff --diff-format=udiff --dry-run --verbose"
run: "vendor/bin/php-cs-fixer fix --ansi --config=.php-cs-fixer.php --diff --dry-run --verbose"

static-code-analysis:
name: "Static Code Analysis"
Expand All @@ -90,10 +90,7 @@ jobs:
- "7.4"

phpunit-version:
- "6.0.0"
- "7.0.0"
- "8.0.0"
- "9.0.0"
- "9.1.0"

dependencies:
- "lowest"
Expand Down
6 changes: 3 additions & 3 deletions .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
__DIR__ . '/LICENSE.md',
License\Year::fromString('2018'),
License\Holder::fromString('Jan Gregor Emge-Triebel'),
License\Url::fromString('https://github.com/Jan0707/phpstan-prophecy')
License\Url::fromString('https://github.com/Jan0707/phpstan-prophecy'),
);

$license->save();

$config = PhpCsFixer\Config\Factory::fromRuleSet(new PhpCsFixer\Config\RuleSet\Php71($license->header()), [
$config = PhpCsFixer\Config\Factory::fromRuleSet(new PhpCsFixer\Config\RuleSet\Php74($license->header()), [
'final_class' => false,
]);

Expand All @@ -36,7 +36,7 @@
->ignoreDotFiles(false)
->in(__DIR__)
->name('*.phpstub')
->name('.php_cs');
->name('.php-cs-fixer.php');

$config->setCacheFile(__DIR__ . '/.build/php-cs-fixer/.php_cs.cache');

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ coding-standards: vendor ## Normalizes composer.json with ergebnis/composer-norm
composer normalize
yamllint -c .yamllint.yaml --strict .
mkdir -p .build/php-cs-fixer
vendor/bin/php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --verbose
export PHP_CS_FIXER_IGNORE_ENV=1 && vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --verbose

.PHONY: help
help: ## Displays this list of targets with descriptions
Expand All @@ -26,7 +26,7 @@ static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan
.PHONY: static-code-analysis-baseline
static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with phpstan/phpstan and vimeo/psalm
mkdir -p .build/phpstan
vendor/bin/phpstan analyze --configuration=phpstan-with-extension.neon --generate-baseline=phpstan-with-extension-baseline.neon --memory-limit=-1
vendor/bin/phpstan analyze --configuration=phpstan-with-extension.neon --generate-baseline=phpstan-with-extension-baseline.neon --allow-empty-baseline --memory-limit=-1
vendor/bin/phpstan analyze --configuration=phpstan-without-extension.neon --generate-baseline=phpstan-without-extension-baseline.neon --memory-limit=-1

.PHONY: tests
Expand Down
14 changes: 8 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@
}
],
"require": {
"php": "^7.1 || ^8.0",
"phpstan/phpstan": "^1.0.0"
"php": "^7.4 || ^8.0",
"phpstan/phpstan": "^2.0.0"
},
"conflict": {
"phpspec/prophecy": "<1.7.0 || >=2.0.0",
"phpunit/phpunit": "<6.0.0 || >=12.0.0"
"phpspec/prophecy": "<1.17.0 || >=2.0.0",
"phpspec/prophecy-phpunit": "<2.3.0 || >=3.0.0",
"phpunit/phpunit": "<9.1.0 || >=12.0.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.1.1",
"ergebnis/license": "^1.0.0",
"ergebnis/php-cs-fixer-config": "~2.2.0",
"ergebnis/php-cs-fixer-config": "^4.0 || ^5.0 || ^6.0",
"phpspec/prophecy": "^1.7.0",
"phpunit/phpunit": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0"
"phpspec/prophecy-phpunit": "^2.3",
"phpunit/phpunit": "^9.1.0"
},
"config": {
"allow-plugins": {
Expand Down
Loading